package 建造者模式;

public class A {
    public static class Buider {
        String id;
        String name;
        int num;
        double score;

        public Buider(String id, String name) {
            this.id = id;
            this.name = name;
        }

        public Buider setNum(int num) {
            this.num = num;
            return this;
        }

        public Buider setScore(double score) {
            this.score = score;
            return this;
        }

        public A build() {
            return new A(this);
        }

    }

    String id;
    String name;
    int num;
    double score;

    public A(Buider buider) {
        this.id = buider.id;
        this.name = buider.name;
        this.num = buider.num;
        this.score = buider.score;
    }

    @Override
    public String toString() {
        return "A{" +
                "id='" + this.id + '\'' +
                ", name='" + this.name + '\'' +
                ", num=" + this.num +
                ", score=" + this.score +
                '}';
    }
}
